﻿<%@ Page Language="C#" MasterPageFile="~/Design/MasterPage/MasterPage.master" AutoEventWireup="true"
    CodeFile="MenuForm.aspx.cs" Inherits="App_Input_MenuForm" Title="菜单信息" %>

<%@ Register Assembly="ShpmCommon" Namespace="Shpm.System.Web.Control" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script type="text/javascript">
function changeDrp()
{
    //alert("");
    
    window.document.getElementById('<%=DrpWeek.ClientID %>').disabled=false;
    window.document.getElementById('<%=txtDate.ClientID %>').disabled=true;
}
function changeTxt()
{
    //alert("");
    
    window.document.getElementById('<%=DrpWeek.ClientID %>').disabled=true;
    window.document.getElementById('<%=txtDate.ClientID %>').disabled=false;
}


function addDishs()
{

 getDishs();
var cntId='<%=DishList.ClientID%>';
var strDishs=window.document.getElementById('<%=hidDishs.ClientID %>').value;

window.open('../Commons/DishSearchForm.aspx?CONTROL_ID='+cntId+"&DISHS="+strDishs,'EmployeesSearchForm','scrollbars,resizable');

}

function getDishs()
{
 var dishs = window.document.getElementById('<%=DishList.ClientID %>');
 var strDishs="";
  for(var i=0; i<dishs.length; i++)
    {

        if(strDishs == null || strDishs == "")
        {
           strDishs= dishs.options[i].value;
        }
        else
        {
            strDishs = strDishs+","+dishs.options[i].value;
        }

    }
    window.document.getElementById('<%=hidDishs.ClientID %>').value=strDishs;
}

function delDishs()
{
    var dishs = window.document.getElementById('<%=DishList.ClientID %>');
    if(dishs.length<=0 || dishs.selectedIndex <0)
    {
        alert("请选择删除对象");
        return;
    }
    
    
    delSelectEmps(dishs);
    initEmps();
}


function delSelectEmps(dishs)
{
if(dishs.selectedIndex<0)
{
return;
}
dishs.remove(dishs.selectedIndex);
delSelectEmps(dishs);
}


function initEmps()
{
 var dishs = window.document.getElementById('<%=DishList.ClientID %>');
 var strDishs="";
  for(var i=0; i<dishs.length; i++)
    {

        if(strDishs == null || strDishs == "")
        {
           strDishs= dishs.options[i].value+","+dishs.options[i].text;
        }
        else
        {
            strDishs = strDishs+","+dishs.options[i].value+","+dishs.options[i].text;
        }

    }
    window.document.getElementById('<%=hidDishs.ClientID %>').value=strDishs;
}
    </script>

    <br />
    <table class="table_border_line">
        <tr>
            <th colspan="5" align="left" style="text-align: left;">

                <script language="javascript">
        (new TitleBar('SearchBar', '菜肴信息')).showBar();
                </script>

            </th>
        </tr>
        <tr>
            <td style="width: 29px;">
                <span style="color: #ff7300"></span>
            </td>
            <td style="width: 66px;">
                <asp:RadioButton ID="Rbtn1" runat="server" Text="普通" GroupName="type" Checked="True"
                    onclick="changeDrp()" /></td>
            <td style="width: 124px;">
                <asp:DropDownList ID="DrpWeek" runat="server" Width="98px" Enabled="False">
                    <asp:ListItem Value="0">星期天</asp:ListItem>
                    <asp:ListItem Value="1">星期一</asp:ListItem>
                    <asp:ListItem Value="2">星期二</asp:ListItem>
                    <asp:ListItem Value="3">星期三</asp:ListItem>
                    <asp:ListItem Value="4">星期四</asp:ListItem>
                    <asp:ListItem Value="5">星期五</asp:ListItem>
                    <asp:ListItem Value="6">星期六</asp:ListItem>
                </asp:DropDownList></td>
            <td style="width: 71px;">
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td style="width: 29px;">
            </td>
            <td style="width: 66px;">
                <asp:RadioButton ID="Rbtn2" runat="server" Text="特殊" GroupName="type" onclick="changeTxt()" /></td>
            <td style="width: 124px;">
                <asp:TextBox ID="txtDate" runat="server" MaxLength="10" onfocus="new Calendar().show(this);"
                    Width="97px" Enabled="False"></asp:TextBox></td>
            <td style="width: 71px;">
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td style="width: 29px; height: 30px">
            </td>
            <td style="width: 66px; height: 30px">
                菜单时间</td>
            <td style="width: 124px; height: 30px">
                <asp:DropDownList ID="DrpTime" runat="server" DataTextField="Content" DataValueField="DictNo"
                    Width="97px">
                </asp:DropDownList></td>
            <td style="width: 71px; height: 30px">
            </td>
            <td style="height: 30px">
            </td>
        </tr>
    </table>
    <table class="table_border_line">
        <tr>
            <td style="width: 28px">
            </td>
            <td style="width: 66px">
                菜肴</td>
            <td colspan="3">
                <table>
                    <tr>
                        <td>
                            <asp:ListBox ID="DishList" runat="server" Height="123px" SelectionMode="Multiple"
                                Width="336px"></asp:ListBox></td>
                        <td>
                            <table>
                                <tr>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <input id="btnAdd" type="button" value="添 加" runat="server" onclick="addDishs()" /></td>
                                </tr>
                                <tr>
                                    <td>
                                        <input id="btnDel" type="button" value="删 除" runat="server" onclick="delDishs()" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <br />
    <table class="table_border_line">
        <tr>
            <td style="text-align: center; height: 22px;">
                <asp:Button ID="save" runat="server" CssClass="button" OnClientClick="initEmps()"
                    Text="登 记" Width="102px" OnClick="save_Click"  />&nbsp;<asp:Button ID="postBack" runat="server"
                        CssClass="button" Text="返 回" Width="94px" /></td>
        </tr>
    </table>
    <asp:HiddenField ID="hidDishs" runat="server" />
    <cc1:ComValidator ID="ComValidator1" runat="server" CheckItems-Capacity="4">
        <cc1:CheckDateAttribute Code="E0034" ControlToValidator="txtDate" DataFormat="yyyy/mm/dd">
            <cc1:ComAbsParamsAttribute Parameter="特殊日期" />
        </cc1:CheckDateAttribute>
        <cc1:CheckRequiredAttribute Code="E0094" ControlToValidator="txtDate">
            <cc1:ComAbsParamsAttribute Parameter="特殊日期" />
        </cc1:CheckRequiredAttribute>
    </cc1:ComValidator>
</asp:Content>
